<?php
namespace Login\Controller;
use Common\Controller\BaseController;
use Addons\Login\LoginAddon;

class SettingController extends BaseController {
    public function index() {
        $this->IS_POST(function (){
            $data = I('');
            $res = LoginAddon::save_conf(LoginAddon::$conf_name,$data);
            if($res) {
                $this->success('保存成功');
            }
            $this->error('保存失败, 请重新操作');
        });
        $conf = unserialize(C(LoginAddon::$conf_name));
        $this->_web('title', '登录插件配置');
        $this->_web('panel_title', '登录配置');
        $this->_web('breadcrumb', array(
            array('url' => main_url('Admin/Addons/index'), 'title' => '插件管理'),
            array('url' => U('index'), 'title' => $this->get('_web')['panel_title']),
        ));
        $this->assign('info', $conf);
        $this->display();
    }
}